<template>
  <div>
  <el-table
    :data="tableData"
	border
    style="width: 100%; margin: 10px 10px">
    <el-table-column
      prop="distributor_id"
	  width="55"
      label="序号">
    </el-table-column>
	<el-table-column
      prop="name"
      label="用户名">
    </el-table-column>
	<el-table-column
      prop="mobile"
      label="手机号">
    </el-table-column>
    <el-table-column
      prop="truename"
      label="真实姓名">
	</el-table-column>
	<el-table-column
      prop="integral"
      label="积分">
    </el-table-column>
	<el-table-column
      prop="balance"
      label="余额">
    </el-table-column>
	<el-table-column
      prop="ctime"
      label="注册时间">
    </el-table-column>
	<el-table-column label="操作">
      <template slot-scope="scope">
        <el-button
          size="mini"
          @click="handleEdit(scope.$index, scope.row)">详情</el-button>
      </template>
    </el-table-column>
	
  </el-table>
  <el-pagination
	  background
	  layout="prev, pager, next"
	  :page-size="pagesize"
	  @current-change="currentPage"
	  :total="total">
	</el-pagination>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        tableData: [],
		pagesize : 10,
		total: 10,
		page: 1,
		
      }
    },
    methods: {
	  getDistributorList(currentPage){
		this.$axios({
			method:"post",
			url:this.host+"/admin/index.php/Distributor/getDistributorList",
			data:{
				page: currentPage?parseInt(currentPage):this.page,
				pagesize: this.pagesize
			}
		}).then((res)=>{
			this.loading = false  
			console.log(res)
			this.tableData = res.data.list
			this.total = res.data.total
		})
	  },
	  currentPage(val){
		this.getDistributorList(val)
	  },
	  handleEdit(index, row){
		this.$router.push({ path: 'Distributor-edit', query:{distributor_id:row.distributor_id}})
	  },
	
    },
    mounted: function mounted() {
        this.getDistributorList();
    }
  }
</script>
